﻿using AvalonDock;
using System;

namespace Notoric.Gui.Windows
{
    /// <summary>
    /// Interaction logic for LinearCompositionViewPanel.xaml
    /// </summary>
    public partial class LinearCompositionViewPanel : DocumentContent
    {
        #region Constructors

        /// <summary>
        /// Creates a new <see cref="LinearCompositionViewPanel"/>.
        /// </summary>
        public LinearCompositionViewPanel()
        {
            InitializeComponent();
        }

        #endregion

        #region Event Handlers

        /// <summary>
        /// Occurs when the document content has been closed.
        /// </summary>
        /// <param name="sender">Object that has sent the event</param>
        /// <param name="e">Event data</param>
        private void parentControl_Closed(object sender, EventArgs e)
        {
            var view = (ViewModel.Elements.LinearCompositionView)DataContext;
            if (view != null)
            {
                view.UndoStack.Clear();
                view.RedoStack.Clear();
            }
        }

        #endregion
    }
}
